package com.mia.craftstudio.minecraft;

import net.minecraft.util.EnumFacing;
import net.minecraftforge.common.util.ForgeDirection;

/**to make porting easier for myself*/
public class PortUtils {
    public static EnumFacing getOpposite(EnumFacing enumFacing)
    {
        EnumFacing opposite;
        switch (enumFacing){
            case UP:
                opposite = EnumFacing.DOWN;
                break;
            case DOWN:
                opposite = EnumFacing.UP;
                break;
            case NORTH:
                opposite = EnumFacing.SOUTH;
                break;
            case SOUTH:
                opposite = EnumFacing.NORTH;
                break;
            case WEST:
                opposite = EnumFacing.EAST;
                break;
            case EAST:
                opposite = EnumFacing.WEST;
                break;
            default:
                throw new IllegalStateException("Unexpected value: " + enumFacing);
        }
        return opposite;
    }

    public static ForgeDirection getDirectionFromFacing(EnumFacing enumFacing) {
        ForgeDirection fd;
        switch (enumFacing){
            case UP:
                fd = ForgeDirection.UP;
                break;
            case DOWN:
                fd = ForgeDirection.DOWN;
                break;
            case NORTH:
                fd = ForgeDirection.NORTH;
                break;
            case SOUTH:
                fd = ForgeDirection.SOUTH;
                break;
            case WEST:
                fd = ForgeDirection.WEST;
                break;
            case EAST:
                fd = ForgeDirection.EAST;
                break;
            default:
                throw new IllegalStateException("Unexpected value: " + enumFacing);
        }
        return fd;
    }

    public static ForgeDirection[] getDirectionsFromFacing(EnumFacing[] enumFacing) {
        ForgeDirection[] fdlist = new ForgeDirection[enumFacing.length];
        for (int i = 0; i < enumFacing.length; i++) {
            fdlist[i] = getDirectionFromFacing(enumFacing[i]);
        }
        return fdlist;
    }
}
